import echarts from '@/echarts'

let years = [] as any //年
let put = [] as any //贫困人数

export const option = {
    // backgroundColor: '#05224d',
    title: {
        top: '2%',
        text: '近几年贫困人口数量变化',
        subtext: '',
        x: 'center',
        textStyle: {
            fontSize: 20,
            color: '#ffffff'
        }
    },
    tooltip: {
        trigger: 'item',
        formatter: function (params: any) {
            return 1
        }
    },
    grid: {
        top: '15%',
        left: '1%',
        right: '1%',
        bottom: '3%',
        containLabel: true
    },
    legend: {
        itemGap: 50,
        top: '3%',
        right: '5%',
        data: ['贫困人数'],
        textStyle: {
            color: '#f9f9f9',
            borderColor: '#fff',
            fontSize: 15
        }
    },
    xAxis: [
        {
            type: 'category',
            boundaryGap: true,
            axisLine: {
                //坐标轴轴线相关设置。数学上的x轴
                show: true,
                lineStyle: {
                    color: '#f9f9f9'
                }
            },
            axisLabel: {
                //坐标轴刻度标签的相关设置
                textStyle: {
                    color: '#d1e6eb',
                    margin: 15,
                    fontSize: 18
                }
            },
            axisTick: {
                show: false
            },
            data: years
        }
    ],
    yAxis: [
        {
            type: 'value',
            min: 0,
            name: '万人',
            nameTextStyle: {
                color: '#ffffff',
                fontSize: 15
            },
            // max: 140,
            splitNumber: 7,
            splitLine: {
                show: true,
                lineStyle: {
                    color: '#0a3256'
                }
            },

            axisLine: {
                show: false
            },
            axisLabel: {
                margin: 20,
                textStyle: {
                    color: '#ffffff'
                }
            },
            axisTick: {
                show: false
            }
        }
    ],
    series: [
      
        {
            name: '贫困人数',
            type: 'bar',
            barWidth: 20,
            tooltip: {
                show: false
            },
            label: {
                show: true,
                position: 'top',
                textStyle: {
                    color: '#fff'
                }
            },
            itemStyle: {
                normal: {
                    color: function (params: any) {
                        var colorList = [
                            '#0ec1ff',
                            '#10cdff',
                            '#12daff',
                            '#15ebff',
                            '#17f8ff',
                            '#1cfffb',
                            '#1dfff1'
                        ]
                        return colorList[params.dataIndex]
                    }
                }
            },
            data: put
        }
    ]
} as any

export default echarts
